<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MessageView.ascx.cs" Inherits="UserInterface.UserControls.MessageView" %>
<%@ Import Namespace="Domain.Entities" %>
<%@ Import Namespace="UserInterface.Misc" %>
<%@ Import Namespace="System.Web" %>

<div class="message-container <%= MessageClass %>">
    <a name="message_<%= Message.Id %>"></a>
    
    <div class="poster">
        <span class="username"><%= Message.Poster.Username %></span><br>
        <asp:Image ID="AvatarImage" runat="server" /><br>
        <div class="extra">
            <asp:PlaceHolder ID="UserOnlyContentPlaceHolder" runat="server">
                <p><%= GetLocalResourceObject("Joined") %>: <%= OutputTools.FormatDate(Message.Poster.RegisterDateTime) %></p>
                <p><%= GetLocalResourceObject("Posts") %>: <%= Message.Poster.Posts %></p>
                <asp:PlaceHolder ID="PMLinkPlaceHolder" runat="server">
                    <p><a href="PM/Compose.aspx?to=<%= HttpUtility.UrlEncode(Message.Poster.Username) %>"><%= GetLocalResourceObject("SendPrivateMessageLink") %></a></p>
                </asp:PlaceHolder>
            </asp:PlaceHolder>
        </div>
    </div>
    
    <div class="message">
        <div class="header">
            <div class="metadata">
                <%= Resources.Resource.PostedOn %>: <%= OutputTools.FormatDate(Message.PostDateTime)%>
            </div>
        <asp:PlaceHolder ID="ForumTopicInfoPlaceHolder" runat="server">
            <div class="forum-topic-links">
                <ul>
                    <li><%= Resources.Resource.Forum %>: <a href="ViewForum.aspx?forumId=<%= Message.Topic.Forum.Id %>"><%= Message.Topic.Forum.Name %></a></li>
                    <li><%= Resources.Resource.Topic %>: <a href="ViewTopic.aspx?topicId=<%= Message.Topic.Id %>&messageId=<%= Message.Id %>#message_<%= Message.Id %>"><%= Message.Topic.Subject %></a></li>
                </ul>
            </div>
        </asp:PlaceHolder>
            <div class="options">
                <asp:PlaceHolder ID="EditOptionPlaceHolder" runat="server">
                    <span><a href="EditMessage.aspx?messageId=<%= Message.Id %>"><%= GetLocalResourceObject("Edit") %></a></span>
                </asp:PlaceHolder>
                <asp:PlaceHolder ID="QuoteOptionPlaceHolder" runat="server">
                    <span><a href="AddMessage.aspx?topicId=<%= Message.Topic.Id %>&quoteMessageId=<%= Message.Id %>"><%= GetLocalResourceObject("Quote") %></a></span>
                </asp:PlaceHolder>
            </div>
        </div>
    
        <div class="text">
            <%= TextFiltered %>
        </div>
    </div>
    
    <asp:PlaceHolder ID="AttachmentsPlaceHolder" runat="server">
        <asp:Repeater ID="AttachmentsRepeater" runat="server">
            <HeaderTemplate>
                <div class="attachments">
                    <ul>
            </HeaderTemplate>
            <ItemTemplate>
                        <li><a href="DownloadAttachment.aspx?id=<%# Eval("Id") %>"><%# Eval("FileName") %> (<%# Eval("FileLength") %> bytes)</a></li>
            </ItemTemplate>
            <FooterTemplate>
                    </ul>
                </div>
            </FooterTemplate>
        </asp:Repeater>
    </asp:PlaceHolder>
</div>